import httpInstance from "@/utils/http";


export function adminLoginAPI({ username, password }) {
    return httpInstance({
        url: '/admin/login',
        method: 'POST',
        params: {
            username,
            password
        }
    })
}

//获取分类列表
export function adminGetCategoryAPI(params) {
  return httpInstance({
    url: '/category/adminGetCategory',
    params
  })
}

//添加分类
export function addCategoryAPI(data) {
    return httpInstance({
      url: '/category/addCategory',
      method:'POST',
      data
    })
  }
//删除分类
export function deleteCategoryAPI(categoryId) {
  return httpInstance({
    url: '/category/deleteCategory',
    params: {
      categoryId: categoryId
    }
  })
}
//获取详细分类数据
export function getDetailCategoryAPI(id){
  return httpInstance({
    url:'/category/detailCategory',
    params:{
      id
    }
  })
}
//编辑分类
export function UpdateCategoryAPI(data) {
  return httpInstance({
    url: '/category/updateCategory',
    method: 'POST',
    data
  })
}

//获取分类列表(用于商品页)
export function adminGetCategoryInGoodsAPI(params) {
  return httpInstance({
    url: '/category/adminGetCategoryInGoods',
    params
  })
}

//获取详细商品数据
export function adminGetGoodsAPI(params){
  return httpInstance({
    url:'/goods/adminGetGoods',
    params
  })
}



//推荐类型修改
export function recommendChangeAPI(data) {
  return httpInstance({
    url: '/goods/recommendChange',
    method:'POST',
    data
  })
}

//下架
export function stateChangeAPI(state, goodsId) {
  return httpInstance({
    url: '/goods/adminStateChange',
    params: {
      state: state,
      goodsId: goodsId
    }
  })
}



//获取详细商品数据
export function getDetailGoodsAPI(id){
  return httpInstance({
    url:'/goods/adminDetailGoods',
    params:{
      id
    }
  })
}

//获取商品评论
export function getGoodsCommentAPI(params){
  return httpInstance({
    url:'/goods/adminGetGoodsComment',
    params
  })
}

//评论状态修改
export function commentStatusChangeAPI(status, commentId) {
  return httpInstance({
    url: '/goods/commentStatusChange',
    params: {
      status: status,
      commentId: commentId
    }
  })
}

//获取买家数据
export function getUserInfoAPI(params){
  return httpInstance({
    url:'/user/adminGetUserInfo',
    params
  })
}

//获取卖家数据
export function getSellerInfoAPI(params){
  return httpInstance({
    url:'/seller/adminGetSellerInfo',
    params
  })
}

//修改买家账号状态
export function updateUserStatusAPI(params){
  return httpInstance({
    url:'/user/updateUserStatus',
    params
  })
}

//修改卖家账号状态
export function updateSellerStatusAPI(params){
  return httpInstance({
    url:'/seller/updateSellerStatus',
    params
  })
}



